/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* vue */
// @ts-ignore
import { ComponentInstance, ComponentRenderProxy, defineComponent } from 'vue'
import { CommonComponentInstance } from '@model/VC'

interface VShowBlockSetupState {

}

enum VShowBlockEventEnum {
  Input = 'input'
}

export type VShowBlockProps = {
  // 是否显示
  value: boolean
}
export type VShowBlockInstance = ComponentInstance & VShowBlockSetupState
export type VShowBlockVM = ComponentRenderProxy<VShowBlockProps> & CommonComponentInstance

export default defineComponent<VShowBlockProps, VShowBlockSetupState>({
  name: ComponentNameEnum.VShowBlock,
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  setup(props: VShowBlockProps, { emit }) {
    // do some things
  },
  render() {
    /* 样式 */
    const style: Record<string, string> = {
      display: this.value ? 'block' : 'none'
    }
    /* 属性列表 */
    const attrs: Record<string, Record<string, string>> = {
      style
    }
    
    return (
      <div {...attrs}>
        { this.$slots.default }
      </div>
    )
  }
})
